The
OLE Component Object Model
The objects
used by the AVIFile library are all part of the OLE Component Object Model.
Primarily, this means they share certain methods that make them easier to work
with, and the values they return are common to most OLE interface methods.
The OLE
Component Object Model of the file and stream handlers uses the OLE IClassFactory
interface to create instances of their object class. As component objects, they
implement the the IUnknown
You can
determine if an object supports a specific interface by using the QueryInterface
method. If an object supports a specified interface, QueryInterface
returns a pointer to that interface.
You can
increment and decrement the reference count associated with an object by using
the AddRef
When an
application is done using an object, it calls the Release method to
decrement the reference count. When the reference count is zero, the object is
no longer needed and Release frees any resources it uses and destroys
the object. Because an object uses internal resources transparent to the
application, the object is responsible for freeing them. For example, a file
handler might need to close open disk files and free buffer memory when
released.
Most OLE
interface methods return result handles that are defined by using the HRESULT
data type. This data type is made of a severity code, contextual information, a
facility code, and a status code. A return result handle that indicates success
has the value zero. A nonzero value indicates failure and the status code
member of the return result handle provides a basis for additional
interpretation. For additional information about OLE return result handles, see
the OLE Programmer s Reference.